#include <iostream> 
#include <unistd.h>
#include <signal.h>

void sigcb(int signum)
{   
    std::cout << " signal num: " << signum <<std::endl;
    exit(1);
}

int main()
{
    struct sigaction nnew, old;
    nnew.sa_handler = sigcb;

    sigaction(SIGINT, &nnew, &old);

    while (1)
    {
        std::cout << " hello world " << std::endl;
        sleep(1);
        
    }
    
    return 0;
}